home *** CD-ROM | disk | FTP | other *** search
/ IRIX Development Foundation for IRIX 6.4 / SGI IRIX 6.4 Development Foundation.iso / dist / dist6.4 / compiler_dev.idb / usr / include / isam.h.z / isam.h
Encoding:
C/C++ Source or Header  |  1997-09-11  |  15.3 KB  |  378 lines

  1. /* Copyright (C) 1989 Silicon Graphics, Inc. All rights reserved.  */
  2. /*
  3.  * |-----------------------------------------------------------|
  4.  * | Copyright (c) 1991, 1990 MIPS Computer Systems, Inc.      |
  5.  * | All Rights Reserved                                       |
  6.  * |-----------------------------------------------------------|
  7.  * |          Restricted Rights Legend                         |
  8.  * | Use, duplication, or disclosure by the Government is      |
  9.  * | subject to restrictions as set forth in                   |
  10.  * | subparagraph (c)(1)(ii) of the Rights in Technical        |
  11.  * | Data and Computer Software Clause of DFARS 252.227-7013.  |
  12.  * |         MIPS Computer Systems, Inc.                       |
  13.  * |         950 DeGuigne Avenue                               |
  14.  * |         Sunnyvale, California 94088-3650, USA             |
  15.  * |-----------------------------------------------------------|
  16.  */
  17. /***************************************************************************
  18.  *
  19.  *                    RELATIONAL DATABASE SYSTEMS, INC.
  20.  *
  21.  *                            PROPRIETARY DATA
  22.  *
  23.  *  THIS WORK CONTAINS PROPRIETARY INFORMATION AND TRADE SECRETS WHICH ARE 
  24.  *  THE PROPERTY OF RELATIONAL DATABASE SYSTEMS, INC. (RDS).  THIS DOCUMENT 
  25.  *  IS SUBMITTED TO RECIPIENT IN CONFIDENCE.  THE INFORMATION CONTAINED 
  26.  *  HEREIN MAY NOT BE USED, COPIED OR DISCLOSED IN WHOLE OR IN PART EXCEPT 
  27.  *  AS PERMITTED BY WRITTEN AGREEMENT SIGNED BY AN OFFICER OF RDS.
  28.  *
  29.  *  COPYRIGHT (c) 1981, 1986 RELATIONAL DATABASE SYSTEMS, INC., MENLO PARK, 
  30.  *  CALIFORNIA.  All rights reserved.  No part of this work covered by the 
  31.  *  copyright hereon may be reproduced or used in any form or by any means 
  32.  *  -- graphic, electronic, or mechanical, including photocopying, 
  33.  *     recording, taping, or information storage and retrieval systems --
  34.  *  without permission of RDS.
  35.  *
  36.  *  Title:    isam.h
  37.  *  Sccsid:    @(#)isam.h    4.12    5/23/86  18:16:45
  38.  *  Description:
  39.  *        Header file for programs using C-ISAM.
  40.  *
  41.  ***************************************************************************
  42.  */
  43.  
  44. /*
  45.  *       C-ISAM version 3.00
  46.  *  Indexed Sequential Access Method
  47.  *  Relational Database Systems, Inc.
  48.  */
  49. /***********************************************************************
  50.  *
  51.  *  Edit history:
  52.  *
  53.  *  12-Sep-87   MAN     (012)
  54.  *      Added EBIGRECN for COBOL85, used when the relative record number
  55.  *      read, no longer fits into the COBOL data-item that is to hold it.
  56.  *  24-Aug-87   RPL 011
  57.  *      Add error code 166 for bad PL/I F format (PER 6060).
  58.  *      Remove tabs from some comments.
  59.  *  10-Aug-87   IAG 010
  60.  *      This version is to be used with rev. 3 of ISAM. 
  61.  *   4-Jun-87   RPL 009
  62.  *      Move extern data and structure declarations outside of #ifdef.
  63.  *  11-May-87   WKD 008
  64.  *      Add new file status codes for variable length records.
  65.  *  04-Apr-87   WKD 007
  66.  *      Add cobol85 new file status codes.
  67.  *  12-Mar-87   TLF 006
  68.  *      Added comment stating that COLLATE3 code is now used by LPI-RPG
  69.  *      to support indexed files in EBCDIC collating sequence.
  70.  *   6-Mar-87   ABC 005
  71.  *      Comment out extraneous tokens on 'endif' line (non-portable)
  72.  *  21-Jan-87   PLB 004
  73.  *      Undo macro defs for ldint/stint for STORAGE_RIGHT_TO_LEFT case
  74.  *      (these guys are portable as is)
  75.  *  30-Jul-86   RCG 003
  76.  *      Corrected a #end to #endif (causing cc problems)
  77.  *  10-Jul-86  PLB
  78.  *      Handle macro defs for ldint/stint for 386 portability
  79.  *      Add Error defs 142-149 to match with RTLERRORS_IN
  80.  *      Reverse edit history
  81.  *  30-Jan-86 nlb
  82.  *      Add error code for not open for read
  83.  *  21-Aug-85  RPL
  84.  *      Add definitions to support RPG packed keys.
  85.  *
  86.  **********************************************************************/
  87.  
  88. #ifndef _ISAM_INCL        /* avoid multiple include problems */
  89. #define _ISAM_INCL
  90.  
  91. #ifdef __cplusplus
  92. extern "C" {
  93. #endif
  94.  
  95. #define CHARTYPE    0
  96. #define DECIMALTYPE    0
  97. #define CHARSIZE    1
  98.  
  99. #define INTTYPE        1
  100. #define INTSIZE        2
  101.  
  102. #define LONGTYPE    2
  103. #define LONGSIZE    4
  104.  
  105. #define DOUBLETYPE    3
  106. #define DOUBLESIZE    (sizeof(double))
  107.  
  108. #define FLOATTYPE    4
  109. #define FLOATSIZE    (sizeof(float))
  110.  
  111. /*  the following 2 defines are to support RPG Packed keys:  */
  112. #define PACKTYPE        100
  113. #define PACKSIZE        0
  114.  
  115. #define USERCOLL(x)    ((x))
  116.  
  117. #define COLLATE1    0x10
  118. #define COLLATE2    0x20
  119.  
  120. /*  COLLATE3 is used by LPI_RPG to support indexed files in EBCDIC collating sequence  */
  121.  
  122. #define COLLATE3    0x30
  123. #define COLLATE4    0x40
  124. #define COLLATE5    0x50
  125. #define COLLATE6    0x60
  126. #define COLLATE7    0x70
  127.  
  128. #define MAXTYPE        5
  129. #define ISDESC        0x80    /* add to make descending type    */
  130. #define TYPEMASK    0x7F    /* type mask            */
  131.  
  132. #ifdef _BBN            /* BBN Machine has 10 bits/byte    */
  133. #define BYTEMASK  0x3FF        /* mask for one byte        */
  134. #define BYTESHFT  10        /* shift for one byte        */
  135. #else
  136. #define BYTEMASK  0xFF        /* mask for one byte        */
  137. #define BYTESHFT  8        /* shift for one byte        */
  138. #endif
  139.  
  140. #ifndef    __ldint
  141. #define ldint(p)    ((short)(((p)[0]<<BYTESHFT)+((p)[1]&BYTEMASK)))
  142. #define stint(i,p)    ((p)[0]=(i)>>BYTESHFT,(p)[1]=(i))
  143. #endif    /* __ldint */
  144.  
  145. #define ISFIRST        0    /* position to first record    */
  146. #define ISLAST        1    /* position to last record    */
  147. #define ISNEXT        2    /* position to next record    */
  148. #define ISPREV        3    /* position to previous record    */
  149. #define ISCURR        4    /* position to current record    */
  150. #define ISEQUAL        5    /* position to equal value    */
  151. #define ISGREAT        6    /* position to greater value    */
  152. #define ISGTEQ        7    /* position to >= value        */
  153.  
  154. /* isread lock modes */
  155. #define ISLOCK         0x100    /* record lock            */
  156. #define ISWAIT        0x400    /* wait for record lock        */
  157. #define ISLCKW        0x500   /* ISLOCK + ISWAIT              */
  158. #define ISSLEEPLOCK     0x1000  /* IAG                          */
  159.  
  160. /* isopen, isbuild lock modes */
  161. #define ISAUTOLOCK    0x200    /* automatic record lock    */
  162. #define ISMANULOCK    0x400    /* manual record lock        */
  163. #define ISEXCLLOCK    0x800    /* exclusive isam file lock    */
  164.  
  165. #define ISINPUT        0    /* open for input only        */
  166. #define ISOUTPUT    1    /* open for output only        */
  167. #define ISINOUT        2    /* open for input and output    */
  168. #define ISTRANS        4    /* open for transaction proc    */
  169. #define ISNOLOG        8    /* no loggin for this file    */
  170.  
  171. /* audit trail mode parameters */
  172. #define AUDSETNAME    0    /* set new audit trail name    */
  173. #define AUDGETNAME    1    /* get audit trail name        */
  174. #define AUDSTART    2    /* start audit trail         */
  175. #define AUDSTOP        3    /* stop audit trail         */
  176. #define AUDINFO        4    /* audit trail running ?    */
  177.  
  178. #define MAXKEYSIZE    120    /* max number of bytes in key    */
  179. #define NPARTS        8    /* max number of key parts    */
  180.  
  181. #define k_start   k_part[0].kp_start
  182. #define k_leng    k_part[0].kp_leng
  183. #define k_type    k_part[0].kp_type
  184.  
  185. #define ISNODUPS  000        /* no duplicates allowed    */
  186. #define ISDUPS      001        /* duplicates allowed        */
  187. #define DCOMPRESS 002        /* duplicate compression    */
  188. #define LCOMPRESS 004        /* leading compression        */
  189. #define TCOMPRESS 010        /* trailing compression        */
  190. #define COMPRESS  016        /* all compression        */
  191. #define ISCLUSTER 020        /* index is a cluster one       */
  192.  
  193. #define ISAM_ERR_OFFSET    31
  194. #define EDUPL     100+ISAM_ERR_OFFSET           /* Duplicate record     */
  195. #define ENOTOPEN  101+ISAM_ERR_OFFSET           /* File not open        */
  196. #define EBADARG   102+ISAM_ERR_OFFSET           /* Illegal argument     */
  197. #define EBADKEY   103+ISAM_ERR_OFFSET           /* Illegal key desc     */
  198. #define ETOOMANY  104+ISAM_ERR_OFFSET           /* Too many files open  */
  199. #define EBADFILE  105+ISAM_ERR_OFFSET           /* Bad isam file format */
  200. #define ENOTEXCL  106+ISAM_ERR_OFFSET           /* Non-exclusive access */
  201. #define ELOCKED   107+ISAM_ERR_OFFSET           /* Record locked        */
  202. #define EKEXISTS  108+ISAM_ERR_OFFSET           /* Key already exists   */
  203. #define EPRIMKEY  109+ISAM_ERR_OFFSET           /* Is primary key       */
  204. #define EENDFILE  110+ISAM_ERR_OFFSET           /* End/begin of file    */
  205. #define ENOREC    111+ISAM_ERR_OFFSET           /* No record found      */
  206. #define ENOCURR   112+ISAM_ERR_OFFSET           /* No current record    */
  207. #define EFLOCKED  113+ISAM_ERR_OFFSET           /* File locked          */
  208. #define EFNAME    114+ISAM_ERR_OFFSET           /* File name too long   */
  209. #define ENOLOK    115+ISAM_ERR_OFFSET           /* Can't create lock file */
  210.  
  211.  
  212.  
  213. #define EDUPWARN  116+ISAM_ERR_OFFSET           /* Duplicate record (warning) */
  214. #define ENOCRP    117+ISAM_ERR_OFFSET           /* Current record pointer undefined */
  215. #define EBADMEM   118+ISAM_ERR_OFFSET           /* Can't alloc memory   */
  216. #define EBADCOLL  119+ISAM_ERR_OFFSET           /* Bad custom collating */
  217.  
  218. #define EINVOP    120+ISAM_ERR_OFFSET           /* Invalid operation */
  219. #define EBOUNDARY 121+ISAM_ERR_OFFSET           /* Boundary violation on write */
  220. #define EBOUNDSQ  122+ISAM_ERR_OFFSET           /* Boundary violation on sq file */
  221. #define EFNOTAVL  123+ISAM_ERR_OFFSET           /* Not available, closed w/ lock */
  222. #define EINVOPN   124+ISAM_ERR_OFFSET           /* Inconsistent attributes */
  223. #define EOPKYAPP  125+ISAM_ERR_OFFSET           /* Open -APPEND on KEYED file */
  224. #define EOPILDAM  126+ISAM_ERR_OFFSET           /* Open -DAM on non-IDRECT file */
  225. #define EOPKYSAM  127+ISAM_ERR_OFFSET           /* Open -SAM on KEYED file */
  226. #define EILLREAD  128+ISAM_ERR_OFFSET           /* Read on output file */
  227. #define EILLWRITE 129+ISAM_ERR_OFFSET           /* Write on input file */
  228. #define ENOTCLOS  130+ISAM_ERR_OFFSET           /* Open on file not yet closed */
  229. #define EKEYSEQ   131+ISAM_ERR_OFFSET           /* KEY specified on sequential file */
  230. #define EKEYSTR   132+ISAM_ERR_OFFSET           /* KEY specified on stream file */
  231. #define ENKYKEY   133+ISAM_ERR_OFFSET           /* No KEY specified on KEYED file */
  232. #define ENPRINT   134+ISAM_ERR_OFFSET           /* Not a PRINT file */
  233. #define ENSTREAM  135+ISAM_ERR_OFFSET           /* Not a STREAM file */
  234. #define ECALLNF   136+ISAM_ERR_OFFSET           /* CALL dataname name not found */
  235. #define EBFORMAT  137+ISAM_ERR_OFFSET           /* B-format error (35) */
  236. #define EBIFORMAT 138+ISAM_ERR_OFFSET           /* BI format error (36) */
  237. #define ECFORMAT  139+ISAM_ERR_OFFSET           /* C format error (32) */
  238. #define EEFORMAT  140+ISAM_ERR_OFFSET           /* E format error (34) */
  239. #define EIOSTACK  141+ISAM_ERR_OFFSET           /* I/O stack overflow */
  240. #define ECONVERT  142+ISAM_ERR_OFFSET           /* Conversion error */
  241. #define ELISTOVF  143+ISAM_ERR_OFFSET           /* LIST input item too long */
  242. #define EIMPOPEN  144+ISAM_ERR_OFFSET           /* Implicit open failed */
  243. #define EEOFFMT   145+ISAM_ERR_OFFSET           /* EOF found while parsing edited input */
  244. #define EENDSTR   146+ISAM_ERR_OFFSET           /* End of string on GET/PUT STRING */
  245. #define EINVSFMT  147+ISAM_ERR_OFFSET           /* Invalid format item for GET/PUT STRING */
  246. #define EINVIFMT  148+ISAM_ERR_OFFSET           /* Invalid format for GET */
  247. #define ERPGSCR   149+ISAM_ERR_OFFSET           /* Cannot initialize RPG screens */
  248. #define ENOTOPRD  150+ISAM_ERR_OFFSET           /* Not open for read */
  249. #define EILLREW   151+ISAM_ERR_OFFSET           /* REWRITE on input file */
  250. #define ENOPOPEN  152+ISAM_ERR_OFFSET           /* File not OPEN on NON-OPTIONAL */
  251. #define EOPOPEN   153+ISAM_ERR_OFFSET           /* File OPEN on OPTIONAL */
  252. #define ESEQERR   154+ISAM_ERR_OFFSET           /* Sequential error on REW or DELE COBOL85 */
  253. #define ESEQERNR  155+ISAM_ERR_OFFSET           /* Sequential error no next record COBOL85 */
  254. #define EBADSIZE  156+ISAM_ERR_OFFSET           /* Bad record size on variable length record */
  255.  
  256. #define ELOGREAD  157+ISAM_ERR_OFFSET           /* Cannot read log rec  */
  257. #define EBADLOG   158+ISAM_ERR_OFFSET           /* Bad log record       */
  258. #define ELOGOPEN  159+ISAM_ERR_OFFSET           /* Cannot open log file */
  259. #define ELOGWRIT  160+ISAM_ERR_OFFSET           /* Cannot write log rec */
  260. #define ENOTRANS  161+ISAM_ERR_OFFSET           /* No transaction       */
  261. #define ENOSHMEM  162+ISAM_ERR_OFFSET           /* No shared memory     */
  262. #define ENOBEGIN  163+ISAM_ERR_OFFSET           /* No begin work yet    */
  263. #define ENONFS    164+ISAM_ERR_OFFSET           /* Can't use nfs        */
  264. #define EAUDIT    165+ISAM_ERR_OFFSET           /* Audit trail exists   */
  265.  
  266. #define EFFORMAT  166+ISAM_ERR_OFFSET           /* F format error       */
  267. #define EBIGRECN  167+ISAM_ERR_OFFSET           /* Record number tobig for data item */
  268. #ifdef sgi
  269. #define ELONGNAME 168+ISAM_ERR_OFFSET           /* ISAM guest account and/or host names too long */
  270. #endif
  271.  
  272. /* NOTE: Any error codes added to the end of the list above MUST be  */
  273. /*       duplicated in errmap.h for COBOL error mapping and in       */
  274. /*       rtlerrs.in for use by PL/I runtimes.  Corresponding changes */
  275. /*       should be recorded in the language User's Guides.           */
  276.  
  277.  
  278. /*
  279.  * For system call errors
  280.  *   iserrno = errno (system error code 1-99)
  281.  *   iserrio = IO_call + IO_file
  282.  *        IO_call  = what system call
  283.  *        IO_file  = which file caused error
  284.  */
  285.  
  286. #define IO_OPEN      0x10        /* open()    */
  287. #define IO_CREA      0x20        /* creat()    */
  288. #define IO_SEEK      0x30        /* lseek()    */
  289. #define IO_READ      0x40        /* read()    */
  290. #define IO_WRIT      0x50        /* write()    */
  291. #define IO_LOCK      0x60        /* locking()    */
  292. #define IO_IOCTL  0x70        /* ioctl()    */
  293.  
  294. #define IO_IDX      0x01        /* index file    */
  295. #define IO_DAT      0x02        /* data file    */
  296. #define IO_AUD      0x03        /* audit file    */
  297. #define IO_LOK      0x04        /* lock file    */
  298. #define IO_SEM      0x05        /* semaphore file */
  299.  
  300. #define AUDHEADSIZE  14        /* num of bytes in audit header    */
  301.  
  302. #ifdef __cplusplus
  303. }
  304. #endif
  305.  
  306. #ifndef    __ldlong
  307. int ldlong(char *);
  308. #endif    /* __ldlong */
  309.  
  310. #ifndef _NOFLOAT
  311. #ifndef    __ldfloat
  312. double    ldfloat(char *);
  313. #endif    /* __ldfloat */
  314. #ifndef    __lddbl
  315. double    lddbl(char *);
  316. #endif    /* __lddbl */
  317. double ldfltnull(char *, short *);
  318. double lddblnull(char * , short *);
  319. #endif
  320.  
  321. struct keypart
  322.     {
  323.     short kp_start;        /* starting byte of key part    */
  324.     short kp_leng;        /* length in bytes        */
  325.     short kp_type;        /* type of key part        */
  326.     };
  327.  
  328. struct keydesc
  329.     {
  330.     short k_flags;        /* flags            */
  331.     short k_nparts;        /* number of parts in key    */
  332.     struct keypart
  333.     k_part[NPARTS];        /* each key part        */
  334.             /* the following is for internal use only    */
  335.     short k_len;        /* length of whole key        */
  336.     int k_rootnode;        /* pointer to rootnode        */
  337.     };
  338.  
  339. struct dictinfo
  340.     {
  341.     short di_nkeys;        /* number of keys defined    */
  342.     short di_recsize;        /* data record size        */
  343.     short di_idxsize;        /* index record size        */
  344.     int di_nrecords;        /* number of records in file    */
  345.     };
  346.  
  347. extern int iserrno;        /* isam error return code    */
  348. extern int iserrio;        /* system call error code    */
  349. extern int isrecnum;        /* record number of last call    */
  350. extern char isstat1;        /* cobol status characters    */
  351. extern char isstat2;
  352. extern char *isversnumber;    /* C-ISAM version number    */
  353. extern char *iscopyright;    /* RDS copyright        */
  354. extern char *isserial;        /* C-ISAM software serial number */
  355. extern int  issingleuser;    /* set for single user access    */
  356. extern int  is_nerr;        /* highest C-ISAM error code    */
  357. extern char *is_errlist[];    /* C-ISAM error messages    */
  358. /*  error message usage:
  359.  *    if (iserrno >= 100 && iserrno < is_nerr)
  360.  *        printf("ISAM error %d: %s\n", iserrno, is_errlist[iserrno-100]);
  361.  */
  362.  
  363. struct audhead
  364.     {
  365.     char au_type[2];        /* audit record type aa,dd,rr,ww*/
  366.     char au_time[4];        /* audit date-time        */
  367.     char au_procid[2];        /* process id number        */
  368.     char au_userid[2];        /* user id number        */
  369.     char au_recnum[4];        /* record number        */
  370.     };
  371.  
  372. /* Added for prototyping for use in other directories, like libI77 */
  373. extern int mkidxname(char *, char *);
  374. extern int mkdatname(char *, char *);
  375. extern int mklokname(char *, char *);
  376.  
  377. #endif /* ISAM_INCL */
  378.